package com.net;

import android.content.Context;

import com.substation.utils.SPUtils;

/**
 * Created by admin on 2018/1/29.
 */

public class Contants {

    public static String[] IPS = new String[]{"218.200.23.58", "192.168.10.234"};
    public static String[] ports=new String[]{":8080/","8111/"};
//    public static String[] IPS = new String[]{"218.200.23.58", "192.168.0.211"};
//    public static String[] ports = new String[]{":8443/", ":8111/"};

    public static final String login = "security/login";

    public static final String getSubstation = "yxbzdsb/downSubstationAndSubseqpt";
    public static final String downGsubslog = "yxbzdsb/downGsubslog";
    public static final String uploadGsubslog = "yxbzdsb/uploadGsubslog";
    public static final String getTourSubsWork = "yxbdzrw/getTourSubsWork";
    public static final String downTourSubsWorkByGuid = "yxbdzrw/downTourSubsWorkByGuid";
    public static final String upload = "yxbdzrw/upload";
    public static final String getTourDefect = "yxbdzrw/getTourDefect";
    public static final String uploadTourDefect = "yxbdzrw/uploadTourDefect";

    public static String getBaseUrl(Context context) {
        String baseUrl = "https://" + getIP(context, 0) + "powersupply/rest/";
        return baseUrl;
    }

    public static String getIP(Context context, int port) {
        int netCount = (int) SPUtils.get(context, "netCount", 0);
        return IPS[netCount] + ports[port];
    }

    public static String getPicUrl(Context context, String end) {
        String baseUrl = "http://" + getIP(context, 1) + "troubleAttachment/" + end;
        return baseUrl;
    }
}
